var studentModule = require('./student.js');
var klassModule = require('./klass.js');

function klassAssignLeaderTest_1(){
    var tom = new studentModule.Student(1 ,'Tom' , 21 ,new klassModule.klass(2));
    var class3 = new klassModule.klass(3);

    class3.appendMember(tom);
    class3.assignLeader(tom);
    if(tom.klassObj.leader === tom){
        console.log('klassAssignLeaderTest_1 passed!');
    }else{
        console.log('klassAssignLeaderTest_1 failed!');
    }
}

function klassAssignLeaderTest_2(){
    var tom = new studentModule.Student(1 ,'Tom' , 21 ,new klassModule.klass(2));
    var class3 = new klassModule.klass(3);

    class3.assignLeader(tom);
    if(tom.klassObj.leader === tom){
        console.log('klassAssignLeaderTest_2 failed!');
    }else{
        console.log('klassAssignLeaderTest_2 passed!');
    }
}


function klassAppendMemberTest(){
    var tom = new studentModule.Student(1 ,'Tom' , 21 ,new klassModule.klass(2));
    var class2 = new klassModule.klass(2);

    class2.appendMember(tom);

    var expectResult = {number : 2};

    if(tom.klassObj.number == expectResult.number){
        console.log('klassAppendMemberTest passed!');
    }else{
        console.log('klassAppendMemberTest failed!');
    }
}


klassAssignLeaderTest_1();
klassAssignLeaderTest_2();
klassAppendMemberTest();